package day14;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;


public class demo2 {
    @Test
    public void test() {
        List<Integer> list1 = new ArrayList<>(Arrays.asList(10,20,30,40,10));
        List<Integer> list2 = new LinkedList<Integer>(Arrays.asList(10,20,80,40,60));
        list1.retainAll(list2);
        System.out.println(list1);
    }

    @Test
    public void test1() {
        List<Integer> list1 = new ArrayList<>(Arrays.asList(10,20,30,40,10));
        List<Integer> list2 = new LinkedList<Integer>(Arrays.asList(10,20,80,40,60));
        list1.addAll(list2);
        System.out.println(list1);
    }

    @Test
    public void test2() {
        List<Integer> list1 = new ArrayList<>(Arrays.asList(10,20,30,40,10));
        List<Integer> list2 = new LinkedList<Integer>(Arrays.asList(10,20,80,40,60));
        list1.removeAll(list2);
        System.out.println(list1);
    }
}
